/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
struct ListNode* middleNode(struct ListNode* head) {
	struct ListNode* slow;
	struct ListNode* fast;
	slow = fast = head;
	while (fast != NULL && fast->next != NULL) 
	{  
		slow = slow->next;    
		fast = fast->next->next; 
	}  
	/*
	if(fast->next == NULL) 
{
	return slow;
	}
	else if(fast->next->next == NULL) 
{
	return slow->next;
	}
	*/return slow;
}
